#include "dbusClient.hpp"

dbusClient::dbusClient()
{
  conn=sdbus::createSessionBusConnection();
  proxy=sdbus::createProxy(*conn,InterfaceName,"/org/HBTY/ReviewUI");
}

std::vector<long> dbusClient::GetAllTaskList()
{
  std::vector<long> ret;
  proxy->callMethod("GetAllTaskList").onInterface(InterfaceName).storeResultsTo(ret);
  return ret;
}

std::vector<long> dbusClient::GetHandleFinishTaskList(long task_id)
{
  std::vector<long> ret;
  proxy->callMethod("GetHandleFinishRecordListWithTask").onInterface(InterfaceName).withArguments(task_id).storeResultsTo(ret);
  return ret;
}

std::vector<long> dbusClient::GetRecordList(long task_id)
{
  std::vector<long> ret;
  proxy->callMethod("GetRecordList").onInterface(InterfaceName).withArguments(task_id).storeResultsTo(ret);
  return ret;
}

std::tuple<std::string,std::string> dbusClient::GetTaskInf(long task_id)
{
  std::tuple<std::string,std::string> ret;
  proxy->callMethod("GetTaskInf").onInterface(InterfaceName).withArguments(task_id).storeResultsTo(ret);
  return ret;
}

std::tuple<long,std::string,std::string> dbusClient::GetRecordInf(long rec_id)
{
  std::tuple<long,std::string,std::string> ret;
  proxy->callMethod("GetRecordInf").onInterface(InterfaceName).withArguments(rec_id).storeResultsTo(ret);
  return ret;
}

std::vector<std::string> dbusClient::GetCameraIDList()
{
  std::vector<std::string> ret;
  proxy->callMethod("GetCameraIDList").onInterface(InterfaceName).storeResultsTo(ret);
  return ret;
}

bool dbusClient::OutputData(long rec_id,std::string path)
{
  bool ret;
  proxy->callMethod("OutputData").onInterface(InterfaceName).withArguments(rec_id,path).storeResultsTo(ret);
  return ret;
}
